#!/usr/bin/python
# -*- coding: UTF-8 -*-
def digital_root(number):
	if len(str(number))<2:
		return number
	else:
		s = sum(map(int,list(str(number))))
        return digital_root(s)

print digital_root(1)
print digital_root(12)
print digital_root(1646)
